<template>
	<view class="">
		<view class="nav_top-bg">
			<u-navbar title="详情">
				<view class="u-nav-slot" slot="left">
					<u-icon name="arrow-left" @click="go_black" size="19"></u-icon>
					<u-line direction="column" :hairline="false" length="16" margin="0 10px"></u-line>
					<u-icon name="home" @click="goHome" size="20"></u-icon>
				</view>
			</u-navbar>
		</view>
		<view class="top-bg"  :style="'background: url(' + content_info.company_bg_image_url + ') center top no-repeat; background-size: 100% auto'">
			<image @click="shoucang_click" :src="content_info.shoucang == 1 ? '../static/shoucang_xz_icon.png' : '../static/shoucang_icon.png'" mode="widthFix" class="shoucang"></image>
			<view class="d-flex">
				<view class="shigong_company">
					<view class="w-650">
						<view class="d-flex"  @click="shejishi_detail(content_info.userinfo)">
							<image class="touxiang-img" :src="content_info.user.avatar" mode=""></image>
							<view class="">
								<view class="top-list d-flex align-items justify-content-space-between">
									<view class="name-t">{{content_info.company_contact}}</view>
									<view class="company-t d-flex align-items"> <image class="dwImg" src="../../static/jianfang/dw.png" mode="widthFix"></image> {{content_info.company_cityname}} {{content_info.company_areaname}}</view>
								</view>
								<view class="d-flex align-items" v-if="content_info.company_name">
									<view class="gongsi_name">{{content_info.company_name ? content_info.company_name : ''}}</view>
									<image class="gongsi_logo" src="../static/gs.png" mode="widthFix"></image>
								</view>
								<view class="d-flex biaoqian">
									<view class="type-list-m">{{content_info.hangyename}}</view>
								</view>
								
							</view>
						</view>
						<view class="gongsi-line"></view>
						<view class="zhuying">{{content_info.instr}}</view>
					</view>
				</view>
			</view>
			
			<!-- tabs筛选 -->
			<view class="">
				<view class="anliList">
						<u-tabs :list="anli_list" :current="current" lineWidth="48rpx" lineColor="#FF6400" :activeStyle="{
				    color: '#FF6400',
				    fontWeight: 'bold',
				    transform: 'scale(1.05)'
				}" @click="anli_click"></u-tabs>
					</view>
			</view>
			
			<view class="">
				<!-- 设计案例 -->
				<view class="fengge-list" v-if="anli_list[current].id == 6">
					<view class="w-690">
						<view class="choose-fengge margin-top-30"
							v-for="(info_list,index) in infoLists" :key="index" @click="sheji_anli_detial(info_list)">
							<view class="image_postion">
								<image :src="info_list.zhutu_images_firsturl" mode="widthFix" class="fenggeImg"></image>
							</view>
							<view class="fengge-t">{{info_list.content2.title}}</view>
							<view class="type-list d-flex align-items">
								<view class="type-list-m">{{info_list.mianji}}m²</view>
								<view class="type-list-m">{{info_list.price}}万</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 建房案例 -->
				<view class="fengge-list" v-if="anli_list[current].id == 7">
					<view class="w-690">
						<view class="choose-fengge margin-top-30"
							v-for="(info_list,index) in infoLists" :key="index" @click="jianfang_anli_detial(info_list)">
							<view class="image_postion">
								<image :src="info_list.anli_images_first" mode="widthFix" class="fenggeImg"></image>
							</view>
							<view class="fengge-t">{{info_list.content2.title}}</view>
							<view class="type-list d-flex align-items">
								<view class="type-list-m">{{info_list.mianji}}m²</view>
								<view class="type-list-m">长{{info_list.jinshen}}m</view>
								<view class="type-list-m">宽{{info_list.miankuan}}m</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 装修案例 -->
				<view class="fengge-list" v-if="anli_list[current].id == 8">
					<view class="w-690">
						<view class="choose-fengge margin-top-30"
							v-for="(info_list,index) in infoLists" :key="index">
							<view class="image_postion">
								<image :src="info_list.zhutu_images_first" @click="anli_detial(info_list)" mode="widthFix" class="fenggeImg"></image>
							</view>
							<view class="" @click="anli_detial(info_list)">
								<view class="fengge-t">{{info_list.content2.title}}</view>
								<view class="type-list d-flex align-items">
									<view class="type-list-m">{{info_list.mianji}}m²</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 图纸信息 -->
				<view class="fengge-list" v-if="anli_list[current].id == 9">
					<view class="w-690">
						<view class="choose-fengge margin-top-30"
							v-for="(info_list,index) in infoLists" :key="index" @click="tuzhi_go(info_list)">
							<view class="image_postion">
								<image :src="info_list.pingmian_images_first" mode="widthFix" class="fenggeImg"></image>
							</view>
							<view class="fengge-t">{{info_list.content2.title}}</view>
							<view class="type-list d-flex align-items">
								<view class="type-list-m">{{info_list.mianji}}m²</view>
								<view class="type-list-m">{{info_list.jiegouname}}</view>
								<view class="type-list-m">宽{{info_list.miankuan}}m</view>
								<view class="type-list-m">长{{info_list.jinshen}}m</view>
								<view class="type-list-m">{{info_list.wudingname}}</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 产品信息 -->
				<view class="fengge-list" v-if="anli_list[current].id == 11">
					<view class="w-690">
						<view class="shopping d-flex align-items justify-content-space-between">
							<view class="shopping_list" v-for="(info_list,index) in infoLists" :key="index">
								<view class="shopping_postion">
									<image class="shopping_phone" :src="info_list.product_images_first"
										mode="widthFix"></image>
								</view>
								<view class="">
									<view class="sp-name">{{info_list.product_name}}</view>
									<view class="sp-num"> <text class="fuhao">￥</text> {{info_list.price}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="foot_btn d-flex align-items justify-content-center">
			<view class="foot_btn-but">
				<u-button text="获取联系方式" @click="show_pop=true" color="#FF6400"></u-button>
			</view>
		</view>
		<!-- 获取电话弹窗 -->
		<view class="">
			<u-popup :show="show_pop" round="10" :safeAreaInsetBottom="false" mode="center" @close="close">
				<view class="get_phone">
					<view class="phone-t">联系方式</view>
					<view class="phone-num">{{content_info.company_phone}}</view>
					<!-- <view class="shengyu">剩余免费次数：<text class="cishu">2次</text> </view> -->
					<view class="phone-w">
						<u-button text="确定" shape="circle" @click="show_pop=false" color="#FF6400"></u-button>
					</view>
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
	import {
		getGroupUserinfo,
		setshouchangshop,
		getinfotype,
		deleteInfo,
		getXinxilist
	} from '@/api/user.js'
	export default {
		data(){
			return{
				current:0,
				anli_list: [{
					name: '设计案例',
				}, {
					name: '建房案例',
				}, {
					name: '装修案例'
				}, {
					name: '图纸信息'
				}],
				infoLists: [],
				show_pop: false,
				content_id: '',
				content_info: {},
				page:1,
				limit:7,
				option:{},
			}
		},
		async onLoad(option) {
			this.option = option
			await this.get_tuzhi_detail()
			await this.get_info_type()
			this.get_jianfang_list()
		},
		methods:{
			go_black() {
				uni.navigateBack({
					delta: 1
				})
			},
			goHome() {
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			anli_click(item) {
				console.log('item', item);
				this.current = item.index
				this.page = 1
				this.get_jianfang_list()
			},
			// 设计案例详情
			sheji_anli_detial(e){
				console.log("跳转到案例详情",e);
				uni.navigateTo({
					url:'/pagesA/anli_zhanshi/anli_detail?content_id=' + e.content_id
				})
			},
			// 建房案例详情
			jianfang_anli_detial(e){
				console.log("跳转到案例详情",e);
				uni.navigateTo({
					url:'/pagesA/anli_zhanshi/anli_detail?content_id=' + e.content_id
				})
			},
			// 查看案例详情
			anli_detial(e){
				console.log("跳转到案例详情",e);
				uni.navigateTo({
					url:'/pagesA/anli_zhanshi/anli_detail?content_id=' + e.content_id
				})
			},
			// 查看图纸详情
			tuzhi_go(e){
				uni.navigateTo({
					url:'/pagesA/index_top/tuzhi_detail?content_id=' + e.content_id
				})
			},
			// 获取图纸详情
			async get_tuzhi_detail() {
				var data = {
					group_id: this.option.group_id,
					user_id:this.option.user_id,
				}
				await getGroupUserinfo(data).then(res => {
					console.log("获取用户详情详情", res);
					if (res.code == 1) {
						this.content_info = res.data.user_groupinfo
						// let m = []
						// for (let s of this.content_info.diyinfo.zhutu_images_url) {
						// 	console.log("选惠安的啥结果", s);
						// 	m.push({
						// 		image: s
						// 	})
						// }
						// this.list1 = m
					}
				})
			},
			// 获取我发布的信息类型
			async get_info_type() {
				console.log("这个都快死了封疆大吏",this.option.group_id);
				var data = {
					group_id: this.option.group_id,
				}
				await getinfotype(data).then(res => {
					console.log("获取发布类型的信息类型", res);
					if (res.code == 1) {
						this.anli_list = res.data.infotypelist;
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			},
			// 获取我发布的信息列表
			get_jianfang_list(){
				console.log("88888888",this.anli_list);
				var data = {
					page:this.page,
					limit: this.limit,
					group_id: this.option.group_id,
					user_id:this.option.user_id,
					type: this.anli_list[this.current].id,
				}
				getXinxilist(data).then(res => {
					console.log("的发生大法师",res);
					if(res.code == 1){
						if(this.page == 1){
							this.infoLists = res.data.list
						}else {
							this.infoLists = this.infoLists.concat(res.data.list)
						}
						uni.stopPullDownRefresh()
					}
				})
			},
			// 点机收藏按钮
			shoucang_click() {
				console.log("点击收藏按钮");
				var data = {
					group_id: this.option.group_id,
					user_id:this.option.user_id,
				}
				console.log("数据库为", data);
				setshouchangshop(data).then(res => {
					console.log("收藏的店铺为", res);
					if (res.code == 1) {
						uni.showToast({
							title: '收藏成功',
							icon: 'success'
						})
						this.get_tuzhi_detail()
					} else {
						uni.showToast({
							title: '取消收藏',
							icon: 'none'
						})
						this.get_tuzhi_detail()
					}
				})
			},
			shejishi_detail(e) {
				console.log("雇主的id",e);
				if(e.group_id == 1){
					// 跳转雇主的主页
					uni.navigateTo({
						url: '/pagesA/anli_zhanshi/guzhu_detail?group_id=' + e.group_id + '&user_id=' + e.user_id
					})
				}
				if(e.group_id == 3){
					// 跳转设计师的主页
					uni.navigateTo({
						url: '/pagesA/anli_zhanshi/shejishi_detail?group_id=' + e.group_id + '&user_id=' + e.user_id
					})
				}
				
				if(e.group_id == 5 || e.group_id == 6 || e.group_id == 7){
					// 跳转旧房改造 主体建房的主页
					uni.navigateTo({
						url: '/pagesA/index_top/cailiaoshang_detail?group_id=' + e.group_id + '&user_id=' + e.user_id
					})
				}
			},
		}
	}
</script>

<style>
	.image_postion{
		width: 690rpx;
		position: relative;
	}
	
	.choose-fengge {
		width: 690rpx;
		background-color: #fff;
		overflow: hidden;
		border-radius: 10rpx;
		margin-bottom: 25rpx;
	}
	.shopping_postion{
		width: 335rpx;
		position: relative;
	}
	.sp-num {
		font-size: 36rpx;
		font-weight: 600;
		color: #FF4D4F;
		margin: 0rpx 0 15rpx 24rpx;
	}
	.sp-name {
		width: 295rpx;
		font-size: 30rpx;
		color: #333;
		font-weight: 600;
		margin-left: 20rpx;
		margin-top: 20rpx;
		overflow: hidden;
		display: -webkit-box;
		text-overflow: ellipsis;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.shopping_phone {
		width: 335rpx;
		display: block;
		border-top-right-radius: 8rpx;
		border-top-left-radius: 8rpx;
	}
	
	.shopping_list {
		width: 335rpx;
		background-color: #fff;
		border-radius: 8rpx;
	}
	
	.shopping {
		width: 690rpx;
		margin: 20rpx auto;
		flex-wrap: wrap;
	}
	.hour_time {
		font-size: 26rpx;
		color: #999999;
	}
	.del-set{
		position: absolute;
		right: 20rpx;
		top: 30rpx;
	}
	.del_go-del, .set_info-set{
		font-size: 26rpx;
		color: #FF6400;
		margin-top: 20rpx;
		padding: 8rpx 20rpx;
		border-radius: 8rpx;
		background: rgba(0, 0, 0, 0.67);
	}
	.set_info-set{
		color: #FFF !important;
	}
	.set_info {
		font-size: 30rpx;
		color: #444;
		margin-left: 30rpx;
	}
	.del_go {
		font-size: 30rpx;
		color: #FF6400;
	}
	.gugong-info {
		width: 690rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 20rpx auto;
		padding: 25rpx 0;
	}
	.pinlun {
		width: 45rpx;
		display: block;
	}
	
	.plnum {
		font-size: 26rpx;
		color: #9E9E9E;
		margin-left: 7rpx;
	}
	.pinglun-magin {
		margin-right: 50rpx;
	}
	/* 获取电话弹窗 */
	.get_phone {
		width: 540rpx;
	}
	
	.phone-t {
		font-size: 34rpx;
		font-weight: 600;
		text-align: center;
		color: #1D2129;
		margin-bottom: 53rpx;
		padding-top: 40rpx;
	}
	
	.phone-num {
		font-size: 56rpx;
		font-weight: 600;
		text-align: center;
		color: #232323;
		margin-bottom: 30rpx;
	}
	
	.shengyu {
		font-size: 28rpx;
		font-weight: normal;
		color: #999999;
		text-align: center;
	}
	
	.cishu {
		font-size: 28rpx;
		font-weight: normal;
		color: #232323 !important;
	}
	
	.phone-w {
		width: 480rpx;
		margin: auto;
		margin-top: 29rpx;
		padding-bottom: 30rpx;
	}
	
	/* end */
	.gongsi-line{
		width: 650rpx;
		margin: 20rpx auto;
		height: 2rpx;
		background: #E9E9E9;
	}
	.biaoqian{
		margin-top: 8rpx;
	}
	.gongsi_logo{
		width: 32rpx;
		display: block;
		margin-left: 10rpx;
	}
	.gongsi_name{
		font-size: 24rpx;
		font-weight: normal;
		color: #666666;
	}
	.top-list{
		width: 520rpx;
		margin-bottom: 8rpx;
	}
	.fengge-list{
		padding-bottom: 120rpx;
	}
	.foot_btn-but {
		width: 670rpx;
		margin: auto;
	}
	
	.foot_btn {
		width: 750rpx;
		height: 128rpx;
		position: fixed;
		bottom: 0;
		background-color: #fff;
		box-shadow: 0rpx 4rpx 23rpx 0rpx #999;
	}
	.type-list-m1{
		padding: 7rpx 15rpx;
		font-size: 20rpx;
		color: #FF4D4F;
		border-radius: 4.5px;
		background: #FDF2F2;
		margin-right: 10rpx;
	}
	.type-list-1{
		margin-left: 20rpx;
		padding-bottom: 40rpx;
	}
	.fengge-t {
		font-size: 30rpx;
		font-weight: 700;
		line-height: 50rpx;
		color: #333333;
		margin: 27rpx 0 10rpx 20rpx;
	}
	.fenggeImg {
		width: 690rpx;
		display: block;
	}
	.choose-fengge {
		width: 690rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin-bottom: 25rpx;
	}
	.card-ms{
		width: 520rpx;
		font-size: 30rpx;
		font-weight: 600;
		line-height: 38rpx;
		color: #333333;
		overflow: hidden;
		display: -webkit-box;
		text-overflow: ellipsis;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.card-img{
		width: 110rpx;
		display: block;
		margin-right: 10rpx;
	}
	.pinlun {
		width: 45rpx;
		display: block;
	}
	.plnum {
		font-size: 26rpx;
		color: #9E9E9E;
		margin-left: 7rpx;
	}
	
	.pinglun-magin {
		margin-right: 50rpx;
	}
	.hour_time {
		font-size: 26rpx;
		color: #999999;
	}
	.type-list {
		margin: 20rpx 0;
	}
	
	.type-list-m {
		padding: 7rpx 15rpx;
		font-size: 20rpx;
		color: #FF6400;
		border-radius: 8rpx;
		background: #FFF0E7;
		margin-right: 10rpx;
	}
	.guGongMiaoshu{
		width: 640rpx;
		font-size: 32rpx;
		margin: auto;
		color: #333333;
		line-height: 40rpx;
		font-weight: 600;
	}
	.gugong-info{
		width: 690rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 20rpx auto;
		padding: 25rpx 0;
	}
	.anliList {
		width: 690rpx;
		margin: 20rpx auto;
	}
	.sgd-xq-js{
		font-size: 30rpx;
		color: #333;
	}
	.sgd-xq{
		font-size: 30rpx;
		color: #9E9E9E; 
		line-height: 50rpx;
	}
	.tit-size {
		font-size: 36rpx;
		font-weight: 600;
		margin-left: 10rpx;
		color: #333;
	}
	
	.tit {
		display: flex;
		align-items: center;
		margin-bottom: 10rpx;
	}
	
	.line {
		width: 8rpx;
		height: 38rpx;
		background: #FF6400;
	}
	.shigongdui_xx{
		width: 690rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin:20rpx auto;
		padding: 30rpx 0;
	}
	.zhuying{
		font-size: 24rpx;
		font-weight: normal;
		line-height: 42rpx;
		color: #4D5150;
		margin-top: 20rpx;
	}
	.touxiang-img {
		width: 90rpx;
		height: 90rpx;
		border-radius: 50%;
		display: block;
		margin-right: 15rpx;
	}
	
	.name-t {
		font-size: 32rpx;
		font-weight: 600;
		color: #1C2023;
	}
	.dwImg{
		width: 32rpx;
		display: block;
	}
	.company-t{
		font-size: 24rpx;
		color: #999999;
		margin-top: 10rpx;
		margin-left: 10rpx;
	}
	.shoucang {
		width: 64rpx;
		display: block;
		position: absolute;
		top: 30rpx;
		right: 40rpx;
	}
	.shigong_company{
		width: 690rpx;
		margin: auto;
		margin-top: 270rpx;
		background-color: #fff;
		border-radius: 10rpx;
		padding: 30rpx 0;
	}
	.top-bg{
		width: 750rpx;
		height: 434rpx;
		position: relative;
	}
	page {
		background-color: #F7F8FB;
	}
</style>